GetContextInfo(Entity, FieldName)

Returns the named field from a table based on the current context. Use this method to return the RecordID for a table which you can use to build an SQL query. For example, to create charts.

Parameters
  • Entity. Specifies the entity from which to return the field. This can be: Person, Company, Opportunity, Lead, Case, Solution, Channels (teams), Campaigns, Waves, Wave Items, SelectedUser (applicable when viewing the My CRM list), User (currently logged on user).
  • FieldName. Specifies the name of the field to be returned.
Examples

GetContextInfo("case", "case_description");

Returns description for the case that the user is currently viewing.

ThisCompanyId = CRM.GetContextInfo('Company','Comp_CompanyId'); CaseListBlock = CRM.GetBlock('CaseList'); SearchSql = 'Case_PrimaryCompanyId='+ThisCompanyId + " and Case_Status='In Progress' "; CRM.AddContent(CaseListBlock.Execute(SearchSql)); Response.Write(CRM.GetPage());

Displays cases that are currently in progress for the current company context.

This example obtains the unique company ID. Company ID is used in a SQL statement, which selects all cases that match the company's ID and have an In Progress status.

The GetBlock(BlockName) method returns a CRMListBlock object of type CaseList, which is stored in the CaseListBlock variable .

The SELECT statement used to extract the required cases is passed to the CaseListBlock's Execute function. The populated CaseListBlock is then passed as an argument to the AddContent(Content) method to store the page in memory.

Response.Write outputs the generated HTML to the screen.